// packageD/mycomponent/address_parse/address_parse.js
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    address: ''
  },
  observers: {
    show: function (a) {
      this.setData({
        address:''
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    focus(){
      this.setData({
        focusTrue:true
      })
    },
    cancelFocus(){
      this.setData({
        focusTrue:false
      })
    },
    onClose() {
      console.log('11111111111')
      this.triggerEvent('address_parseClose')
    },
    inpblur(e) {
      this.setData({
        address: e.detail.value
      })
    },
    toPostMethod() {
      let urlStr = app.getNetAddresss("plugin.address-parse.frontend.index");
      app._getNetWork({
        url: urlStr,
        data: {
          address: this.data.address
        },
        success: (resdata) => {
          var res = resdata.data;
          if (res.result) {
            this.triggerEvent('toPostMethod', res.data)
          } else {
            app.tips(res.msg)
          }
        },
        fail: function (res) {
          console.log(res);
        },
      });
    },
  }
})